


class Bank():
    __money = 0
    def __init__(self,user,pwd):
        self.__username = user
        self.__pwd = pwd

    def set_money(self,val):
        Bank.__money += val
        print(f'已经为您存入￥{val}元，您的账号余额：￥{Bank.__money}元')
        # print(self.__username)
    def get_money(self,val):
        if Bank.__money>= val:
            Bank.__money -= val
            print(f'已经为您取出￥{val}元，您的账号余额：￥{Bank.__money}元')
        else:
            print('账户余额不足！！')

    def set_pwd(self,new_pwd):
        try:
            if isinstance(new_pwd,str):# 判断newpwd是不是 str数据类型的
                if len(new_pwd)>=6:
                    self.__pwd = new_pwd
                else:
                    print('密码位数不够')

            else:
                raise Exception('密码数据类型不正确')
        except Exception as e:
            print(e)
        print(self.__pwd)

user = Bank('123456','654321')

# print (user.username)
# user.set_money(100)
# user.get_money(50)
#
# user.get_money(50)

user.set_pwd(123456)